package com.wenzhoujie.model;

public class DealOrderItemModel
{
	public static final int EMPTY_STATE = -999;
	
	private int id;
	private String dp_id = null;
	private int consume_count = 0;
	private String deal_icon = null;
	private int number = 0;
	private String sub_name = null;
	private String total_price = null;
	private String unit_price = null;
	private String deal_id = null;
	private String name = null;
	private String numr = null;
	private String price = null;
	private String price_format = null;
	private String total_money = null;
	private String total_money_format = null;
	private String image = null;
	private String attr_content = null;
	
	private int delivery_status; // 0:未发货 1:已发货 5.无需发货
	private int is_arrival; // 0:未收货1:已收货2:没收到货(维权)
	private int is_refund; // 是否支持退款，由商品表同步而来，0不支持 1支持
	private int refund_status; // 0未退款 1退款中 2已退款 3退款被拒

	// add
	private int order_status; // 订单状态
	private int pay_status;
	private int refundState = EMPTY_STATE;
	private int deliveryState = EMPTY_STATE;
	
	/**
	 * 
	 * @return true:实体商品，false:团购商品
	 */
	public boolean isShop()
	{
		boolean isShop = true;
		if (delivery_status == 5)
		{
			isShop = false;
		}
		return isShop;
	}

	public void setOrder_status(int order_status)
	{
		this.order_status = order_status;
	}

	public void setPay_status(int pay_status)
	{
		this.pay_status = pay_status;
	}
	
	/**
	 * 
	 * @return 0:可以退款，1:退款中，2:已退款，3:退款被拒
	 */
	public int getRefundState()
	{
		if (refundState == EMPTY_STATE)
		{
			if (delivery_status == 0)
			{
				if (pay_status == 2)
				{
					if (is_refund == 1)
					{
						if (refund_status == 0)
						{
							refundState = 0;
						} else if (refund_status == 1)
						{
							refundState = 1;
						} else if (refund_status == 2)
						{
							refundState = 2;
						} else if (refund_status == 3)
						{
							refundState = 3;
						}
					}
				}
			} else if (delivery_status == 5)
			{
				if (pay_status == 2)
				{
					if (is_refund == 1)
					{
						if (order_status == 0)
						{
							refundState = 0;
						} else if (order_status == 1)
						{
							if (refund_status == 1)
							{
								refundState = 1;
							} else if (refund_status == 2)
							{
								refundState = 2;
							} else if (refund_status == 3)
							{
								refundState = 3;
							}
						}
					}
				}
			}
		}
		return refundState;
	}
	
	/**
	 * 
	 * @return 0:未发货， 1:已发货，但是未收到货(查询物流操作,确认收货操作，没收到货操作)，2:已收货，3:维权中
	 */
	public int getDeliveryState()
	{
		if (deliveryState == EMPTY_STATE)
		{
			if (order_status == 0)
			{
				if (delivery_status != 5)
				{
					if (delivery_status == 0)
					{
						deliveryState = 0;
					} else if (delivery_status == 1)
					{
						if (is_arrival == 0)
						{
							deliveryState = 1;
						} else if (is_arrival == 1)
						{
							deliveryState = 2;
						} else if (is_arrival == 2)
						{
							deliveryState = 3;
						}
					}
				}
			}
		}
		return deliveryState;
	}

	public int getId()
	{
		return id;
	}

	public void setId(int id)
	{
		this.id = id;
	}

	public String getDp_id() {
		return dp_id;
	}

	public void setDp_id(String dp_id) {
		this.dp_id = dp_id;
	}

	public int getConsume_count() {
		return consume_count;
	}

	public void setConsume_count(int consume_count) {
		this.consume_count = consume_count;
	}

	public String getDeal_icon() {
		return deal_icon;
	}

	public void setDeal_icon(String deal_icon) {
		this.deal_icon = deal_icon;
	}

	public int getNumber() {
		return number;
	}

	public void setNumber(int number) {
		this.number = number;
	}

	public String getSub_name() {
		return sub_name;
	}

	public void setSub_name(String sub_name) {
		this.sub_name = sub_name;
	}

	public String getTotal_price() {
		return total_price;
	}

	public void setTotal_price(String total_price) {
		this.total_price = total_price;
	}

	public String getUnit_price() {
		return unit_price;
	}

	public void setUnit_price(String unit_price) {
		this.unit_price = unit_price;
	}

	public int getDelivery_status() {
		return delivery_status;
	}

	public void setDelivery_status(int delivery_status) {
		this.delivery_status = delivery_status;
	}

	public int getIs_arrival() {
		return is_arrival;
	}

	public void setIs_arrival(int is_arrival) {
		this.is_arrival = is_arrival;
	}

	public int getIs_refund() {
		return is_refund;
	}

	public void setIs_refund(int is_refund) {
		this.is_refund = is_refund;
	}

	public int getRefund_status() {
		return refund_status;
	}

	public void setRefund_status(int refund_status) {
		this.refund_status = refund_status;
	}

	public void setDeliveryState(int deliveryState) {
		this.deliveryState = deliveryState;
	}

	public String getDeal_id() {
		return deal_id;
	}

	public void setDeal_id(String deal_id) {
		this.deal_id = deal_id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getNumr() {
		return numr;
	}

	public void setNumr(String numr) {
		this.numr = numr;
	}

	public String getPrice() {
		return price;
	}

	public void setPrice(String price) {
		this.price = price;
	}

	public String getPrice_format() {
		return price_format;
	}

	public void setPrice_format(String price_format) {
		this.price_format = price_format;
	}

	public String getTotal_money() {
		return total_money;
	}

	public void setTotal_money(String total_money) {
		this.total_money = total_money;
	}

	public String getTotal_money_format() {
		return total_money_format;
	}

	public void setTotal_money_format(String total_money_format) {
		this.total_money_format = total_money_format;
	}

	public String getImage() {
		return image;
	}

	public void setImage(String image) {
		this.image = image;
	}

	public String getAttr_content() {
		return attr_content;
	}

	public void setAttr_content(String attr_content) {
		this.attr_content = attr_content;
	}

}